{% extends "../../theme/base_view.html" %}
{% block head %}
<title>{{ calc_info.title }}|在线地图|历史地图</title>
<meta name="keywords" content="{{ calc_info.keywords }},在线地图,历史地图">
<meta name="description" content="{% module generate_description(calc_info.cnt_html) %}">

<script src="{{ static_url('f2elib/leaflet_1.0.1/leaflet.js') }}"></script>
<link rel="stylesheet" href="{{ static_url('f2elib/leaflet_1.0.1/leaflet.css') }}">

<style type="text/css">
    #map {
        width: 100%;
        height: 640px;
    }
</style>
<script>
$.get('/rel/map/{{ calc_info.uid }}');
var map_uid = "{{ calc_info.uid }}";
var vlon = {{ kwd['vlon'] if 'vlon' in kwd else calc_info.extinfo['ext_lon'] }};
var vlat = {{ kwd['vlat'] if 'vlat' in kwd else calc_info.extinfo['ext_lat'] }};
var vzoom_current = {{ kwd['vzoom'] if 'vzoom' in kwd else calc_info.extinfo['ext_zoom_current'] }};
var vzoom_max = {{ calc_info.extinfo['ext_zoom_max'] }};
var vzoom_min = {{ calc_info.extinfo['ext_zoom_min'] }};
var vmarker = {{ kwd['marker']}};
var geojsonid = "{{ kwd['geojson'] }}";
var login = {{ kwd['login'] }};

      del_layout = function(layout_id) {
    return $.ajax({
      url: "/layout/delete/" + layout_id,
      type: "GET",
      cache: false,
      data: {},
      dataType: "html",
      timeout: 1000,
      error: function() {
        return alert("删除失败！");
      },
      success: function(result) {
        return alert("删除成功！暂请手动刷新页面！");
      }
    });
  };

  del_geojson = function(gson_id) {
    return $.ajax({
      url: "/geojson/delete/" + gson_id,
      type: "GET",
      cache: false,
      data: {},
      dataType: "html",
      timeout: 1000,
      error: function() {
        return alert("删除失败！");
      },
      success: function(result) {
        return alert("删除成功，暂请手动刷新页面！");
      }
    });
  };

</script>

{% block headinfo %}
{% end %}
{% end %}
{% block zhuti %}


{#
<div class="alert alert-info">建议：<a href="/user/login">登陆</a>后会列出用户最近使用App的信息！</div>
#}

<div class="panel panel-black">
    {% if userinfo %}
    {% else %}
<div class="alert alert-warning">
    <a class="close" data-dismiss="alert" href="#" aria-hidden="true"> &times; </a>
    基于WebGIS技术，地图可以在线浏览、放大、缩小，也可对不同的地图进行叠加操作。</div>
{% end %}
    <div class="panel-heading">

        <H1 >{{ calc_info.title }}</H1>

        <div class="container" style="width: auto;">
            <div class="row">

                <div class="col-md-9" style="text-align: left">


                        <span>分类:</span>
                        <span class="app_tag">{% module app_tags( kwd['signature']) %}</span>

                        <span>发布日期:</span>
                        <span class="">{{ str(calc_info.date)[:10] }}</span>



                         <a class="btn btn-info btn-xs" href="/map/{{calc_info.uid}}?fullscreen=1&gson={{ kwd['geojson'] }}" target="_blank">

                             <span class="glyphicon glyphicon-fullscreen"></span>
                             全屏</a>


                     <button id="act_collect" class="btn btn-info btn-xs">
                         <span class="glyphicon glyphicon-heart-empty"></span>
                            <span id="text_collect">收藏</span>
                        </button>


                         {% module widget_editor('meta', postinfo.uid, userinfo) %}

                </div>

                <div class="col-md-3" style="text-align: right;">
                    <button id="act_eval0" class="btn btn-xs btn-warning">
                <span class="glyphicon glyphicon-thumbs-down"></span>
                 (<span id="eval0">{{ kwd['eval_0'] }}</span>)
            </button>
            <button id="act_eval1" class="btn btn-xs btn-success">
                <span class="glyphicon glyphicon-thumbs-up"></span>
                 (<span id="eval1">{{ kwd['eval_1'] }}</span>)
            </button>
                </div>
            </div>
        </div>
    </div>

    <div class="panel-body">
        <div id="map" class="map" tabindex="0"></div>
    </div>


    <div class="panel-body">


        <ul class="list-group">
            <li class="list-group-item">

                <a id="save_view" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-save">保存视图</span></a>
                <a id="current_view_url" href="{{ kwd['site_url'] }}{{ kwd['url'] }}">{{ kwd['site_url'] }}{{
                kwd['url'] }}</a>
</li>
    </ul>




<ul class="list-group">

     <li class="list-group-item"><h4 class="list-group-item-heading">用户视图链接</h4></li>
     {% if userinfo %}
            {% module app_layout(calc_info.uid, userinfo.uid) %}
            {% end %}


    <li class="list-group-item">
        <h4 class="list-group-item-heading" style="display: inline-block;">用户地图数据 </h4> <span class="text-info bg-info"> 全屏后可进行数据编辑</span></li>
     {% if userinfo %}
          {% module app_json(calc_info.uid, userinfo.uid) %}
          {% end %}
</ul>

  </div>


 <div class="panel-heading">
<h4 class="panel-title">地图说明
</h4>
</div>
    <div class="panel-body">
        <div id="wiki_cnt">
            {% raw unescape(calc_info.cnt_html) %}
        </div>
    </div>
<div class="panel-body">
     <p style="border-bottom: 1px dashed #dddddd; margin-bottom: 20px">&nbsp;</p>

    {% module reply_panel(postinfo.uid, userinfo) %}
     
</div>

    <div class="panel-footer">
        <div class="row">
            <div class="col-md-6">
                <span>标签:</span>
                <span class="post_cat">
                    {% set iii = 1 %}
                    {% for x in tag_info %}
                    <a href="/list_label/{{ x.tag.uid }}" class="app_label tag{{ iii }}">{{ x.tag.name }}</a>
                    {% set iii = iii + 1 %}
                    {% end %}
                </span>
            </div>
            <div class="col-md-6"></div>
        </div>

        <div class="row">

            <div class="col-md-6">
        地图链接： <a href="{{ kwd['site_url'] }}/map/{{ calc_info.uid }}">{{ calc_info.title }}</a>
    </div>

    <div class="col-md-6 ">
        {% if 1 == 2 %}
        <div class="widget_baidu_share"> {% module baidu_share() %}</div>
        {% end %}
    </div>
        </div>


    </div>

</div>


{% end %}

{% block right %}

<div class="panel panel-black">
    <div class="panel-heading">地图叠加</div>
    <div class="panel-body">
         {% if userinfo is None %}

        <div class="alert alert-default">

            <form action="javascript:;" class="form-horizontal" role="form">
                <fieldset>

                    <div class="form-group">

                        <div class="col-sm-12">
                            <select id="over_map_1" name="over_map_1" class="form-control">
                                {% for recent in kwd['map_hist_arr'] %}
                                <option value="{{recent}}">{{recent}}</option>
                                {% end %}
                            </select>
                        </div>
                    </div>

                    <div class="form-group">


                        <div class="col-sm-12">
                            <select id="over_map_2" name="over_map_2" class="form-control">
                                <option value=""></option>
                                {% for recent in kwd['map_hist_arr'] %}
                                <option value="{{recent}}">{{recent}}</option>
                                {% end %}
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-3">
                            <button id="btn_overlay" name="btn_overlay" class="btn btn-sm btn-info">叠加</button>
                        </div>
                    </div>

                </fieldset>
            </form>

        </div>

        {% else %}

            <form action="javascript:;" class="form-horizontal" role="form">
                <fieldset>

                    <div class="form-group">
                                               <div class="col-sm-12">
                            <select id="over_map_1" name="over_map_1" class="form-control">
                                {% for recent in recent_apps %}
                                <option value="{{recent.post.uid}}">{{recent.post.uid}} |
                                    {{recent.post.title}}
                                </option>
                                {% end %}
                            </select>
                        </div>

                    </div>

                    <div class="form-group">



                        <div class="col-sm-12">
                            <select id="over_map_2" name="over_map_2" class="form-control">
                                <option value=""></option>
                                {% for recent in recent_apps %}
                                <option value="{{recent.post.uid}}">{{recent.post.uid}} |
                                    {{recent.post.title}}
                                </option>
                                {% end %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-3">
                            <button id="btn_overlay" name="btn_overlay" class="btn btn-info btn-sm">叠加</button>
                        </div>
                    </div>

                </fieldset>
            </form>
        {% end %}
    </div>
</div>


<div class="panel panel-black">
    <div class="panel-heading"> <h3 class="panel-title">相关地图</h3> </div> 
    <ul class="list-group" style="overflow: hidden;">
        {% for x in relations %}
        <li class="list-group-item" style="overflow: hidden;">
            <a href="/map/{{ x.post.uid }}">
                 <span class="glyphicon glyphicon-map-marker"></span>{{ x.post.title }}
               {% if x.post.uid[0] == 'v' %}<span class="badge" style="color:yellow">v</span>{% end %}
            </a>
        </li>
        {% end %}
        {% for x in rand_recs %}
        <li class="list-group-item" style="overflow: hidden;">
            <a href="/map/{{ x.uid }}">
                 <span class="glyphicon glyphicon-map-marker"></span>{{ x.title }}
                {% if x.uid[0] == 'v' %}<span class="badge" style="color:yellow">v</span>{% end %}
            </a>
        </li>
        {% end %}
    </ul>
</div>

<div class="panel panel-black">
    <div class="panel-heading"> <h3 class="panel-title"> 相关文档 </h3> </div>
    {%  module rel_app2post(calc_info.uid, 4) %}
</div>


<div class="panel panel-black">
    <div class="panel-heading"> <h3 class="panel-title"> 最近浏览的地图 </h3> </div>

    <ul class="list-group">
        {% if userinfo is None %}
        {% module app_recent_used(5) %}
        {% else %}
        {% module app_user_recent(userinfo.user_name, 5) %}
        {% end %}
    </ul>

</div>

<div class="panel panel-black">
    <div class="panel-heading">
        <h3 class="panel-title">
            浏览最多的地图
        </h3>
    </div>

    <ul class="list-group">
        {% if userinfo is None %}
        {% module app_most_used(5) %}
        {% else %}
        {% module app_user_most(userinfo.user_name, 5) %}
        {% end %}
    </ul>
</div>

<script src="{{ static_url('jslib/maplet/mapshowm.js') }}"></script>

{% end %}
